﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for tblTicket
/// </summary>
public class tblTicket
{
    SqlConnection conn;
    SqlCommand cmd;
	public tblTicket()
	{
        conn = new SqlConnection("server=localhost ; database = OnlineBooking;uid = sa ; pwd=12345678");
	}

    public DataTable getallflight(string codestart, string codeemd) {

        if (conn.State == ConnectionState.Closed)
            conn.Open();
        string sql = "select * from Ticket where Codestart=@start and  Codeend=@end";
        cmd = new SqlCommand(sql, conn);
        cmd.Parameters.AddWithValue("@start",codestart);
        cmd.Parameters.AddWithValue("@end", codeemd);
        DataTable table = new DataTable();
        SqlDataAdapter data = new SqlDataAdapter(cmd);
        data.Fill(table);
        conn.Close();
        return table;
    
    } 
}